﻿<!DOCTYPE HTML>
<html lang="zh">
<head>
<title>GroupClose - 语法 &amp; 使用 | AutoHotkey v2</title>
<meta name="description" content="The GroupClose function closes the active window if it was just activated by the GroupActivate or GroupDeactivate function." />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
<script type="text/javascript">$(function(){0<=window.navigator.userAgent.toLowerCase().indexOf("ucbrowser")&&CaoNiMaDeUc()})</script>
</head>
<body>

<h1>GroupClose</h1>

<p>Closes the active window if it was just activated by <a href="GroupActivate.htm">GroupActivate</a> or <a href="GroupDeactivate.htm">GroupDeactivate</a>. It then activates the next window in the series. It can also close all windows in a group.</p>

<pre class="Syntax"><span class="func">GroupClose</span> GroupName <span class="optional">, Mode</span></pre>
<h2 id="Parameters">参数</h2>
<dl>

  <dt>GroupName</dt>
  <dd>
    <p>类型: <a href="../Concepts.htm#strings">字符串</a></p>
    <p>The name of the group as originally defined by <a href="GroupAdd.htm">GroupAdd</a>.</p>
  </dd>

  <dt>Mode</dt>
  <dd>
    <p>类型: <a href="../Concepts.htm#strings">字符串</a></p>
    <p>If omitted, the function closes the active window and activates the oldest window in the series. To change this behavior, specify one of the following letters:</p>
    <p><strong>R:</strong> The newest window (the one most recently active) is activated, but only if no members of the group are active when the function is given. &quot;R&quot; is useful in cases where you temporarily switch to working on an unrelated task. When you return to the group via <a href="GroupActivate.htm">GroupActivate</a>, <a href="GroupDeactivate.htm">GroupDeactivate</a>, or GroupClose, the  window you were most recently working with is activated rather than the oldest window.</p>
    <p><strong>A:</strong> All members of the group will be closed. This is the same effect as <code><a href="WinClose.htm">WinClose</a> "ahk_group GroupName"</code>.</p>
  </dd>

</dl>

<h2 id="Remarks">备注</h2>
<p>When the <em>Mode</em> parameter is not &quot;A&quot;, the behavior of this function is determined by whether the previous action on <em>GroupName</em> was <a href="GroupActivate.htm">GroupActivate</a> or <a href="GroupDeactivate.htm">GroupDeactivate</a>.  If it was <a href="GroupDeactivate.htm">GroupDeactivate</a>, this function will close the active window only if it is <strong>not</strong> a member of the group (otherwise it will do nothing). If it was <a href="GroupActivate.htm">GroupActivate</a> or nothing, this function will close the active window only if it <strong>is</strong>  a member of the group (otherwise it will do nothing). This behavior allows GroupClose to be assigned to a hotkey as a companion to <em>GroupName</em>'s <a href="GroupActivate.htm">GroupActivate</a> or <a href="GroupDeactivate.htm">GroupDeactivate</a> hotkey.</p>
<p>关于窗口组的更多细节, 请参阅 <a href="GroupAdd.htm">GroupAdd</a>.</p>
<h2 id="Related">相关</h2>
<p><a href="GroupAdd.htm">GroupAdd</a>, <a href="GroupActivate.htm">GroupActivate</a>, <a href="GroupDeactivate.htm">GroupDeactivate</a></p>
<h2 id="Examples">示例</h2>
<div class="ex" id="ExBasic">
<p><a href="#ExBasic">#1</a></p>
<pre>GroupClose "MyGroup", "R"</pre>
</div>

</body>
</html>